package com.hxzy.controller.mobile.order;

import com.hxzy.common.resp.R;
import com.hxzy.controller.mobile.order.req.OrderCreateReq;
import com.hxzy.service.OrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Author wy
 * @Description TODO
 * @Date 2023/9/28 14:37
 * @Version 1.0
 */
@Api(tags = "手机端-订单")
@RestController
@RequestMapping(value = "/mobile/order")
public class MobileOrderController {

    @Autowired
    private OrdersService ordersService;

    @ApiOperation(value = "创建订单")
    @PostMapping(value = "/submit")
    public R<String> createOrder(@RequestBody @Valid OrderCreateReq req){
        String orderNumber=this.ordersService.createOrder(req);
        //返回商家订单号
        return  R.okHasData(orderNumber);
    }

}